package com.example.framework2002a.view.fragment;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;

import androidx.databinding.DataBindingUtil;
import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.framework2002a.HomeActivity;
import com.example.framework2002a.R;
import com.example.framework2002a.databinding.FragmentOneBinding;

public class OneFragment extends Fragment {

    private FragmentOneBinding binding;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        binding = DataBindingUtil.inflate(inflater,R.layout.fragment_one,container,false);

        SharedPreferences pref = getActivity().getSharedPreferences("sp", Context.MODE_PRIVATE);
        if (pref.getString("login","").equals("1")){
            startActivity(new Intent(getContext(), HomeActivity.class));
        }

        return binding.getRoot();

    }
}